//
// CCamera.java
// Copyright (C) 2010  "Naush" <naush _ hotmail _ fr>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as
// published by the Free Software Foundation, either version 3 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>./* ----------------------------------------------------------------------------







package org.ryzom.nel.threed;

import org.ryzom.nel.misc.CVector;

public class CCamera {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CCamera(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CCamera obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        throw new UnsupportedOperationException("C++ destructor does not have public access");
      }
      swigCPtr = 0;
    }
  }

  public static void registerBasic() {
    nel3dJNI.CCamera_registerBasic();
  }

  public void build(CCameraInfo info) {
    nel3dJNI.CCamera_build(swigCPtr, this, CCameraInfo.getCPtr(info), info);
  }

  public void setFrustum(CFrustum f) {
    nel3dJNI.CCamera_setFrustum__SWIG_0(swigCPtr, this, CFrustum.getCPtr(f), f);
  }

  public CFrustum getFrustum() {
    return new CFrustum(nel3dJNI.CCamera_getFrustum__SWIG_0(swigCPtr, this), false);
  }

  public void setFrustum(float left, float right, float bottom, float top, float znear, float zfar, boolean perspective) {
    nel3dJNI.CCamera_setFrustum__SWIG_1(swigCPtr, this, left, right, bottom, top, znear, zfar, perspective);
  }

  public void setFrustum(float left, float right, float bottom, float top, float znear, float zfar) {
    nel3dJNI.CCamera_setFrustum__SWIG_2(swigCPtr, this, left, right, bottom, top, znear, zfar);
  }

  public void setFrustum(float width, float height, float znear, float zfar, boolean perspective) {
    nel3dJNI.CCamera_setFrustum__SWIG_3(swigCPtr, this, width, height, znear, zfar, perspective);
  }

  public void setFrustum(float width, float height, float znear, float zfar) {
    nel3dJNI.CCamera_setFrustum__SWIG_4(swigCPtr, this, width, height, znear, zfar);
  }

  public void getFrustum(SWIGTYPE_p_float left, SWIGTYPE_p_float right, SWIGTYPE_p_float bottom, SWIGTYPE_p_float top, SWIGTYPE_p_float znear, SWIGTYPE_p_float zfar) {
    nel3dJNI.CCamera_getFrustum__SWIG_1(swigCPtr, this, SWIGTYPE_p_float.getCPtr(left), SWIGTYPE_p_float.getCPtr(right), SWIGTYPE_p_float.getCPtr(bottom), SWIGTYPE_p_float.getCPtr(top), SWIGTYPE_p_float.getCPtr(znear), SWIGTYPE_p_float.getCPtr(zfar));
  }

  public boolean isOrtho() {
    return nel3dJNI.CCamera_isOrtho(swigCPtr, this);
  }

  public boolean isPerspective() {
    return nel3dJNI.CCamera_isPerspective(swigCPtr, this);
  }

  public void setPerspective(float fov, float aspectRatio, float znear, float zfar) {
    nel3dJNI.CCamera_setPerspective(swigCPtr, this, fov, aspectRatio, znear, zfar);
  }

  public boolean enableFovAnimation(boolean en, float aspectRatio) {
    return nel3dJNI.CCamera_enableFovAnimation__SWIG_0(swigCPtr, this, en, aspectRatio);
  }

  public boolean enableFovAnimation(boolean en) {
    return nel3dJNI.CCamera_enableFovAnimation__SWIG_1(swigCPtr, this, en);
  }

  public boolean enableTargetAnimation(boolean en) {
    return nel3dJNI.CCamera_enableTargetAnimation(swigCPtr, this, en);
  }

  public void setTargetPos(CVector pos) {
    nel3dJNI.CCamera_setTargetPos__SWIG_0(swigCPtr, this, CVector.getCPtr(pos), pos);
  }

  public void setTargetPos(float x, float y, float z) {
    nel3dJNI.CCamera_setTargetPos__SWIG_1(swigCPtr, this, x, y, z);
  }

  public void setRoll(float roll) {
    nel3dJNI.CCamera_setRoll(swigCPtr, this, roll);
  }

  public void setFov(float fov) {
    nel3dJNI.CCamera_setFov(swigCPtr, this, fov);
  }

  public void getTargetPos(CVector pos) {
    nel3dJNI.CCamera_getTargetPos(swigCPtr, this, CVector.getCPtr(pos), pos);
  }

  public float getRoll() {
    return nel3dJNI.CCamera_getRoll(swigCPtr, this);
  }

  public float getFov() {
    return nel3dJNI.CCamera_getFov(swigCPtr, this);
  }

  public static String getFovValueName() {
    return nel3dJNI.CCamera_getFovValueName();
  }

  public static String getTargetValueName() {
    return nel3dJNI.CCamera_getTargetValueName();
  }

  public static String getRollValueName() {
    return nel3dJNI.CCamera_getRollValueName();
  }

  public IAnimatedValue getValue(long valueId) {
    long cPtr = nel3dJNI.CCamera_getValue(swigCPtr, this, valueId);
    return (cPtr == 0) ? null : new IAnimatedValue(cPtr, false);
  }

  public String getValueName(long valueId) {
    return nel3dJNI.CCamera_getValueName(swigCPtr, this, valueId);
  }

  public ITrack getDefaultTrack(long valueId) {
    long cPtr = nel3dJNI.CCamera_getDefaultTrack(swigCPtr, this, valueId);
    return (cPtr == 0) ? null : new ITrack(cPtr, false);
  }

  public void registerToChannelMixer(CChannelMixer chanMixer, String prefix) {
    nel3dJNI.CCamera_registerToChannelMixer(swigCPtr, this, CChannelMixer.getCPtr(chanMixer), chanMixer, prefix);
  }

  public CTrackDefaultVector getDefaultPos() {
    long cPtr = nel3dJNI.CCamera_getDefaultPos(swigCPtr, this);
    return (cPtr == 0) ? null : new CTrackDefaultVector(cPtr, false);
  }

  public CTrackDefaultVector getDefaultTargetPos() {
    long cPtr = nel3dJNI.CCamera_getDefaultTargetPos(swigCPtr, this);
    return (cPtr == 0) ? null : new CTrackDefaultVector(cPtr, false);
  }

  public void buildCameraPyramid(SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t pyramid, boolean useWorldMatrix) {
    nel3dJNI.CCamera_buildCameraPyramid(swigCPtr, this, SWIGTYPE_p_std__vectorT_NLMISC__CPlane_t.getCPtr(pyramid), useWorldMatrix);
  }

  public void buildCameraPyramidCorners(Vector_CVector pyramidCorners, boolean useWorldMatrix) {
    nel3dJNI.CCamera_buildCameraPyramidCorners(swigCPtr, this, Vector_CVector.getCPtr(pyramidCorners), pyramidCorners, useWorldMatrix);
  }

  public final static class TAnimValues {
    public final static TAnimValues OwnerBit = new TAnimValues("OwnerBit", nel3dJNI.CCamera_OwnerBit_get());
    public final static TAnimValues FovValue = new TAnimValues("FovValue");
    public final static TAnimValues TargetValue = new TAnimValues("TargetValue");
    public final static TAnimValues RollValue = new TAnimValues("RollValue");
    public final static TAnimValues AnimValueLast = new TAnimValues("AnimValueLast");

    public final int swigValue() {
      return swigValue;
    }

    public String toString() {
      return swigName;
    }

    public static TAnimValues swigToEnum(int swigValue) {
      if (swigValue < swigValues.length && swigValue >= 0 && swigValues[swigValue].swigValue == swigValue)
        return swigValues[swigValue];
      for (int i = 0; i < swigValues.length; i++)
        if (swigValues[i].swigValue == swigValue)
          return swigValues[i];
      throw new IllegalArgumentException("No enum " + TAnimValues.class + " with value " + swigValue);
    }

    private TAnimValues(String swigName) {
      this.swigName = swigName;
      this.swigValue = swigNext++;
    }

    private TAnimValues(String swigName, int swigValue) {
      this.swigName = swigName;
      this.swigValue = swigValue;
      swigNext = swigValue+1;
    }

    private TAnimValues(String swigName, TAnimValues swigEnum) {
      this.swigName = swigName;
      this.swigValue = swigEnum.swigValue;
      swigNext = this.swigValue+1;
    }

    private static TAnimValues[] swigValues = { OwnerBit, FovValue, TargetValue, RollValue, AnimValueLast };
    private static int swigNext = 0;
    private final int swigValue;
    private final String swigName;
  }

}
